|
|
|
|
|
|
|
Note that the code in Listing 19.17 requires a few parameters. The first is the number of the rows requested. The second parameter is the data row returned, and the last is the caller's data form that contains the input controls. Notice that the routine assumes that the controls on the caller's form are called sqlField and are part of a control array. This is a requirement for all forms that call this library. |
|
|
|
|
|
|
|
|
Next, you need the GetSQLField method. Add this from the code in Listing 19.18. |
|
|
|
|
|
|
|
|
Listing 19.18. Coding the GetSQLField method. |
|
|
|
|
|
|
|
|
Private Function GetSQLField(strLine As String, intField As Integer)
'
' get a field from the line
'
Dim intLoop As Integer
Dim lngPosMark As Long
Dim lngPosEnd As Long
Dim intCol As Integer
'
strLine = "|" & strLine & "|"
lngPosMark = 1
lngPosEnd = 0
intCol = 0
'
For intLoop = 1 To NumCols
lngPosMark = InStr(lngPosMark, strLine, "|")
If lngPosMark <> 0 Then
intCol = intCol + 1
If intCol = intField Then
lngPosEnd = InStr(lngPosMark + 1, strLine, "|")
Exit For
End If
lngPosMark = lngPosMark + 1
End If
Next
'
If lngPosEnd <> 0 Then
GetSQLField = Mid(strLine, lngPosMark + 1, lngPosEnd - (lngPosMark + 1))
Else
GetSQLField = ""
End If
'
End Function |
|
|
|
|
|